﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Web;

namespace Comm
{
    /// <summary>
    /// 提示类
    /// </summary>
    public class MessageBox
    {


        /// <summary>
        /// 提示信息 并刷新
        /// </summary>
        /// <param name="message">提示信息</param>
        public static void ShowReplace(string message)
        {
            HttpContext.Current.Response.Write("<script type=\"text/javascript\">alert(\"" + message + "\");window.location.href=window.location.href;</script>");
            HttpContext.Current.Response.End();
        }

        /// <summary>
        /// 提示信息
        /// </summary>
        /// <param name="message">提示信息</param>
        public static void Show(string message)
        {
            HttpContext.Current.Response.Write("<script type=\"text/javascript\">alert(\"" + message + "\");window.history.back();</script>");
            HttpContext.Current.Response.End();
        }

        /// <summary>
        /// 加载当前页面
        /// </summary>
        /// <param name="Web_Page"></param>
        public static void ReplaceLoad()
        {
            HttpContext.Current.Response.Write("<script type=\"text/javascript\">window.location.href=window.location.href;</script>");
        }

        /// <summary>
        /// 加载当前页面
        /// </summary>
        /// <param name="Web_Page"></param>
        public static void Script(string script)
        {
            HttpContext.Current.Response.Write("<script type=\"text/javascript\">" + script + "</script>");
        }

        /// <summary>
        /// 提示并跳转
        /// </summary>
        /// <param name="message"></param>
        /// <param name="url"></param>
        public static void ShowRedirect(string message, string url)
        {
            HttpContext.Current.Response.Write("<script type=\"text/javascript\">alert(\"" + message + "\");window.location.href='" + url + "';</script>");
            HttpContext.Current.Response.End();
        }
    }
}
